<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddedCafesParentChildrenRelationship extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        Schema::table('cafes',function (Blueprint $table){
            $table->integer('parent_id')->nullable(false)->default(0)->after('id')->comment('父级id');
            $table->string('location_name')->nullable(false)->default('')->after('name')->comment('分店位置名称');
            $table->tinyInteger('roaster')->nullable(false)->default('0')->after('longitude')->comment('烘焙师');
            $table->string('website')->nullable(false)->default('')->after('roaster')->comment('网址');
            $table->string('description')->nullable(false)->default('')->after('website')->comment('简介');
            $table->integer('added_by')->nullable(false)->default(0)->after('description')->comment('添加者');

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
        Schema::table('cafes', function( Blueprint $table ){
            $table->dropColumn('parent_id');
            $table->dropColumn('location_name');
            $table->dropColumn('roaster');
            $table->dropColumn('website');
            $table->dropColumn('description');
            $table->dropColumn('added_by');
        });
    }
}
